using Admin.NET.Core;
using MOKA.TPM.Entity;
using System.ComponentModel.DataAnnotations;

namespace MOKA.TPM.Service.Dto;

/// <summary>
/// 页面输出参数 （生产设备）
/// </summary>
public class EquipmentOutput : Equipment
{   
    /// <summary>
    /// 公司代码 （字典或人员名称）
    /// </summary>
    public string? CompanyCodeNo { get; set; }
    /// <summary>
    /// 公司代码 （字典或人员名称）
    /// </summary>
    public string? CompanyCodeName { get; set; }

    /// <summary>
    /// TPM设备分组 （字典或人员名称）
    /// </summary>
    public string? TPMDeviceGroupName { get; set; }

    /// <summary>
    /// 设备类型 （字典或人员名称）
    /// </summary>
    public string? TPMCategory { get; set; }

    /// <summary>
    /// 设备类型名称 （字典或人员名称）
    /// </summary>
    public string? TPMCategoryName { get; set; }

    /// <summary>
    /// 使用部门 （字典或人员名称）
    /// </summary>
    public string? UserDepartmentName { get; set; }

    /// <summary>
    /// 设备状态 （字典或人员名称）
    /// </summary>
    public string? EquipmentStatusName { get; set; }

    /// <summary>
    /// 品牌 （字典或人员名称）
    /// </summary>
    public string? BrandName { get; set; }

    /// <summary>
    /// 供应商 （字典或人员名称）
    /// </summary>
    public string? SupplierName { get; set; }

    /// <summary>
    /// 管理员 （字典或人员名称）
    /// </summary>
    public string? ManagerName { get; set; }

    /// <summary>
    /// 使用人 （字典或人员名称）
    /// </summary>
    public string? UserNoName { get; set; }

    /// <summary>
    /// 点检人 （字典或人员名称）
    /// </summary>
    public string? CheckuperName { get; set; }

    /// <summary>
    /// 保养人 （字典或人员名称）
    /// </summary>
    public string? UpkeeprName { get; set; }

    /// <summary>
    /// 所在地 （字典或人员名称）
    /// </summary>
    public string? PositionName { get; set; }

    /// <summary>
    /// 區域 （字典或人员名称）
    /// </summary>
    public string? AreaName { get; set; }

    /// <summary>
    /// 資產編號
    /// </summary>
    public string? AssetNo { get; set; }

    /// <summary>
    /// 创建用户 （字典或人员名称）
    /// </summary>
    public string? CreateUserName { get; set; }

    /// <summary>
    /// 更新用户 （字典或人员名称）
    /// </summary>
    public string? UpdateUserName { get; set; }

    public Guid CompanyCode { get; set; }  //唯一索引

    public string EquipmentNo { get; set; }  //唯一索引
}

/// <summary>
/// 单ID查询参数
/// </summary>
public class EquipmentInput
{
    /// <summary>
    /// </summary>
    public Guid? Id { get; set; }
}

/// <summary>
/// 普通查询参数
/// </summary>
public class GetEquipmentInput : BaseOrderInput
{
    /// <summary>
    /// 公司代码
    /// </summary>
    public Guid? CompanyCode { get; set; }  //唯一索引

    /// <summary>
    /// 设备编号
    /// </summary>
    public string? EquipmentNo { get; set; }  //唯一索引
}

/// <summary>
/// 分页查询参数
/// </summary>
public class PageEquipmentInput : BasePageInput
{
    /// <summary>
    /// 公司代码
    /// </summary>
    public Guid? CompanyCode { get; set; }  //唯一索引

    /// <summary>
    /// 设备编号
    /// </summary>
    public string? EquipmentNo { get; set; }  //唯一索引

    /// <summary>
    /// 设备名称
    /// </summary>
    public string? Name { get; set; }

    /// <summary>
    /// 设备名称2
    /// </summary>
    public string? AlternativeName { get; set; }

    /// <summary>
    /// 管理编号
    /// </summary>
    public string? ManageNo { get; set; }

    /// <summary>
    /// TPM设备分组
    /// </summary>
    public Guid? TPMDeviceGroupId { get; set; }

    /// <summary>
    /// 设备类型
    /// </summary>
    public Guid? TPMCategoryId { get; set; }

    /// <summary>
    /// 使用部门
    /// </summary>
    public string? UserDepartmentID { get; set; }

    /// <summary>
    /// 固定资产标识
    /// </summary>
    public bool? IsAsset { get; set; }

    /// <summary>
    /// 资产编号
    /// </summary>
    public Guid? AssetId { get; set; }

    /// <summary>
    /// 设备状态
    /// </summary>
    public Guid? EquipmentStatus { get; set; }

    /// <summary>
    /// 品牌
    /// </summary>
    public Guid? Brand { get; set; }

    /// <summary>
    /// 型号
    /// </summary>
    public string? Model { get; set; }

    /// <summary>
    /// 供应商
    /// </summary>
    public Guid? Supplier { get; set; }

    /// <summary>
    /// 管理员
    /// </summary>
    public string? Manager { get; set; }

    /// <summary>
    /// 使用人
    /// </summary>
    public string? UserNo { get; set; }

    /// <summary>
    /// 点检人
    /// </summary>
    public string? Checkuper { get; set; }

    /// <summary>
    /// 保养人
    /// </summary>
    public string? Upkeepr { get; set; }

    /// <summary>
    /// 所在地
    /// </summary>
    public Guid? Position { get; set; }

    /// <summary>
    /// 區域
    /// </summary>
    public Guid? Area { get; set; }
}

/// <summary>
/// 新增记录参数
/// </summary>
public class AddEquipmentInput
{
    /// <summary>
    /// 公司代码
    /// </summary>
    public Guid CompanyCode { get; set; }

    /// <summary>
    /// 设备编号
    /// </summary>
    [Required, MaxLength(20)]
    public string EquipmentNo { get; set; } = string.Empty;

    /// <summary>
    /// 设备名称
    /// </summary>
    [Required, MaxLength(50)]
    public string Name { get; set; } = string.Empty;

    /// <summary>
    /// 设备名称2
    /// </summary>
    [MaxLength(50)]
    public string? AlternativeName { get; set; }

    /// <summary>
    /// 管理编号
    /// </summary>
    [MaxLength(30)]
    public string? ManageNo { get; set; }

    /// <summary>
    /// TPM设备分组
    /// </summary>
    public Guid TPMDeviceGroupId { get; set; }

    /// <summary>
    /// 设备类型
    /// </summary>
    public Guid TPMCategoryId { get; set; }

    /// <summary>
    /// 使用部门
    /// </summary>
    [MaxLength(50)]
    public string? UserDepartmentID { get; set; }

    /// <summary>
    /// 固定资产标识
    /// </summary>
    public bool IsAsset { get; set; }

    /// <summary>
    /// 资产编号
    /// </summary>
    public Guid? AssetId { get; set; }

    /// <summary>
    /// 设备状态
    /// </summary>
    public Guid EquipmentStatus { get; set; }

    /// <summary>
    /// 品牌
    /// </summary>
    public Guid? Brand { get; set; }

    /// <summary>
    /// 型号
    /// </summary>
    [MaxLength(50)]
    public string? Model { get; set; }

    /// <summary>
    /// 供应商
    /// </summary>
    public Guid? Supplier { get; set; }

    /// <summary>
    /// 入厂日期
    /// </summary>
    public DateTime? EnterDate { get; set; }

    /// <summary>
    /// 购入日期
    /// </summary>
    public DateTime? PurchaseDate { get; set; }

    /// <summary>
    /// 管理员
    /// </summary>
    [MaxLength(20)]
    public string? Manager { get; set; }

    /// <summary>
    /// 使用人
    /// </summary>
    [MaxLength(20)]
    public string? UserNo { get; set; }

    /// <summary>
    /// 点检人
    /// </summary>
    [MaxLength(20)]
    public string? Checkuper { get; set; }

    /// <summary>
    /// 保养人
    /// </summary>
    [MaxLength(20)]
    public string? Upkeepr { get; set; }

    /// <summary>
    /// 所在地
    /// </summary>
    public Guid Position { get; set; }

    /// <summary>
    /// 互联IP
    /// </summary>
    [MaxLength(20)]
    public string? IP { get; set; }

    /// <summary>
    /// 端口
    /// </summary>
    public int? Port { get; set; }

    /// <summary>
    /// 采集间隔
    /// </summary>
    public int? Interval { get; set; }

    /// <summary>
    /// 注册地址
    /// </summary>
    [MaxLength(20)]
    public string? RegisterAdder { get; set; }

    /// <summary>
    /// PLC端口
    /// </summary>
    public int? PLCPort { get; set; }

    /// <summary>
    /// PLC类型
    /// </summary>
    [MaxLength(30)]
    public string? PLCType { get; set; }

    /// <summary>
    /// 图片
    /// </summary>
    public byte[] Picture { get; set; }

    /// <summary>
    /// 关键字
    /// </summary>
    [MaxLength(50)]
    public string? Remark { get; set; }

    /// <summary>
    /// 创建用户
    /// </summary>
    [Required, MaxLength(20)]
    public string CreateUser { get; set; } = string.Empty;

    /// <summary>
    /// 创建时间
    /// </summary>
    public DateTime CreateTime { get; set; }

    /// <summary>
    /// 更新用户
    /// </summary>
    [MaxLength(20)]
    public string? UpdateUser { get; set; }

    /// <summary>
    /// 更新时间
    /// </summary>
    public DateTime? UpdateTime { get; set; }

    /// <summary>
    /// 子表：点检设备
    /// </summary>
    public List<Checkup> Checkups { get; set; }//一对多

    ///// <summary>
    ///// 子表：设备变动历史
    ///// </summary>
    //public List<EquipmentChange> EquipmentChanges { get; set; }//一对多

    ///// <summary>
    ///// 子表：设备参数
    ///// </summary>
    //public List<EquipmentParas> EquipmentParases { get; set; }//一对多

    ///// <summary>
    ///// 子表：设备配件
    ///// </summary>
    //public List<EquipmentParts> EquipmentPartses { get; set; }//一对多

    ///// <summary>
    ///// 子表：设备寄存器信息
    ///// </summary>
    //public List<EquipmentPLC> EquipmentPLCs { get; set; }//一对多

    ///// <summary>
    ///// 子表：设备维修信息
    ///// </summary>
    //public List<EquipmentRepair> EquipmentRepairs { get; set; }//一对多

    ///// <summary>
    ///// 子表：设备SOP
    ///// </summary>
    //public List<EquipmentSop> EquipmentSops { get; set; }//一对多

    ///// <summary>
    ///// 子表：设备保养计划所属设备
    ///// </summary>
    //public List<UpkeepPlanEquipment> UpkeepPlanEquipments { get; set; }//一对多
}

/// <summary>
/// 更新参数
/// </summary>
public class UpdateEquipmentInput
{
    /// <summary>
    /// Id
    /// </summary>
    public Guid Id { get; set; }

    /// <summary>
    /// 公司代码
    /// </summary>
    public Guid CompanyCode { get; set; }

    /// <summary>
    /// 设备编号
    /// </summary>
    [MaxLength(20)]
    public string EquipmentNo { get; set; }

    /// <summary>
    /// 设备名称
    /// </summary>
    [MaxLength(50)]
    public string Name { get; set; }

    /// <summary>
    /// 设备名称2
    /// </summary>
    [MaxLength(50)]
    public string? AlternativeName { get; set; }

    /// <summary>
    /// 管理编号
    /// </summary>
    [MaxLength(30)]
    public string? ManageNo { get; set; }

    /// <summary>
    /// TPM设备分组
    /// </summary>
    public Guid TPMDeviceGroupId { get; set; }

    /// <summary>
    /// 设备类型
    /// </summary>
    public Guid TPMCategoryId { get; set; }

    /// <summary>
    /// 使用部门
    /// </summary>
    [MaxLength(50)]
    public string? UserDepartmentID { get; set; }

    /// <summary>
    /// 固定资产标识
    /// </summary>
    public bool IsAsset { get; set; }

    /// <summary>
    /// 资产编号
    /// </summary>
    public Guid? AssetId { get; set; }

    /// <summary>
    /// 设备状态
    /// </summary>
    public Guid EquipmentStatus { get; set; }

    /// <summary>
    /// 品牌
    /// </summary>
    public Guid? Brand { get; set; }

    /// <summary>
    /// 型号
    /// </summary>
    [MaxLength(50)]
    public string? Model { get; set; }

    /// <summary>
    /// 供应商
    /// </summary>
    public Guid? Supplier { get; set; }

    /// <summary>
    /// 入厂日期
    /// </summary>
    public DateTime? EnterDate { get; set; }

    /// <summary>
    /// 购入日期
    /// </summary>
    public DateTime? PurchaseDate { get; set; }

    /// <summary>
    /// 管理员
    /// </summary>
    [MaxLength(20)]
    public string? Manager { get; set; }

    /// <summary>
    /// 使用人
    /// </summary>
    [MaxLength(20)]
    public string? UserNo { get; set; }

    /// <summary>
    /// 点检人
    /// </summary>
    [MaxLength(20)]
    public string? Checkuper { get; set; }

    /// <summary>
    /// 保养人
    /// </summary>
    [MaxLength(20)]
    public string? Upkeepr { get; set; }

    /// <summary>
    /// 所在地
    /// </summary>
    public Guid Position { get; set; }

    /// <summary>
    /// 互联IP
    /// </summary>
    [MaxLength(20)]
    public string? IP { get; set; }

    /// <summary>
    /// 端口
    /// </summary>
    public int? Port { get; set; }

    /// <summary>
    /// 采集间隔
    /// </summary>
    public int? Interval { get; set; }

    /// <summary>
    /// 注册地址
    /// </summary>
    [MaxLength(20)]
    public string? RegisterAdder { get; set; }

    /// <summary>
    /// PLC端口
    /// </summary>
    public int? PLCPort { get; set; }

    /// <summary>
    /// PLC类型
    /// </summary>
    [MaxLength(30)]
    public string? PLCType { get; set; }

    /// <summary>
    /// 图片
    /// </summary>
    public byte[] Picture { get; set; }

    /// <summary>
    /// 关键字
    /// </summary>
    [MaxLength(50)]
    public string? Remark { get; set; }

    /// <summary>
    /// 创建用户
    /// </summary>
    [MaxLength(20)]
    public string CreateUser { get; set; }

    /// <summary>
    /// 创建时间
    /// </summary>
    public DateTime CreateTime { get; set; }

    /// <summary>
    /// 更新用户
    /// </summary>
    [MaxLength(20)]
    public string? UpdateUser { get; set; }

    /// <summary>
    /// 更新时间
    /// </summary>
    public DateTime? UpdateTime { get; set; }

    /// <summary>
    /// 子表：点检设备
    /// </summary>
    public List<Checkup> Checkups { get; set; }//一对多

    ///// <summary>
    ///// 子表：设备变动历史
    ///// </summary>
    //public List<EquipmentChange> EquipmentChanges { get; set; }//一对多

    ///// <summary>
    ///// 子表：设备参数
    ///// </summary>
    //public List<EquipmentParas> EquipmentParases { get; set; }//一对多

    ///// <summary>
    ///// 子表：设备配件
    ///// </summary>
    //public List<EquipmentParts> EquipmentPartses { get; set; }//一对多

    ///// <summary>
    ///// 子表：设备寄存器信息
    ///// </summary>
    //public List<EquipmentPLC> EquipmentPLCs { get; set; }//一对多

    ///// <summary>
    ///// 子表：设备维修信息
    ///// </summary>
    //public List<EquipmentRepair> EquipmentRepairs { get; set; }//一对多

    ///// <summary>
    ///// 子表：设备SOP
    ///// </summary>
    //public List<EquipmentSop> EquipmentSops { get; set; }//一对多

    ///// <summary>
    ///// 子表：设备保养计划所属设备
    ///// </summary>
    //public List<UpkeepPlanEquipment> UpkeepPlanEquipments { get; set; }//一对多    ///// <summary>
    ///// 子表：设备变动历史
    ///// </summary>
    //public List<EquipmentChange> EquipmentChanges { get; set; }//一对多

    ///// <summary>
    ///// 子表：设备参数
    ///// </summary>
    //public List<EquipmentParas> EquipmentParases { get; set; }//一对多

    ///// <summary>
    ///// 子表：设备配件
    ///// </summary>
    //public List<EquipmentParts> EquipmentPartses { get; set; }//一对多

    ///// <summary>
    ///// 子表：设备寄存器信息
    ///// </summary>
    //public List<EquipmentPLC> EquipmentPLCs { get; set; }//一对多

    ///// <summary>
    ///// 子表：设备维修信息
    ///// </summary>
    //public List<EquipmentRepair> EquipmentRepairs { get; set; }//一对多

    ///// <summary>
    ///// 子表：设备SOP
    ///// </summary>
    //public List<EquipmentSop> EquipmentSops { get; set; }//一对多

    ///// <summary>
    ///// 子表：设备保养计划所属设备
    ///// </summary>
    //public List<UpkeepPlanEquipment> UpkeepPlanEquipments { get; set; }//一对多
}

/// <summary>
/// 删除参数
/// </summary>
public class DeleteEquipmentInput
{
    /// <summary>
    /// </summary>
    public Guid Id { get; set; }
}

/// <summary>
/// 更新部分数据参数
/// </summary>
public class UpdateSomeEquipmentInput : UpdateEquipmentInput
{
    public List<string> ToUpdateFields { get; set; } = new List<string>();
}